<extend name="Common/base" />
<block name="content">
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=SC1n3KjGW9rYZGs5tPqpE7dKQnwfcSU9"></script>
<div class="col-md-10">
	<div class="row">
		<div class="panel panel-default bootstrap-admin-no-table-panel">
			<div class="panel-heading">
				<div class="text-muted bootstrap-admin-box-title">基础信息</div>
			</div>
			<div class="bootstrap-admin-no-table-panel-content bootstrap-admin-panel-content collapse in">
				<form class="form-horizontal" id="mysubfrom">
					<div class="form-group">
						<label class="col-lg-2 control-label" for="focusedInput">公司名称</label>
						<div class="col-lg-6">
							<input class="form-control" datatype="*" value="{$member_info['company_name']}" name="company_name" errormsg="公司名称不能为空" nullmsg="公司名称不能为空" type="text" >
						</div>
					</div>
					<div class="form-group">
						<label class="col-lg-2 control-label">简介</label>
						<div class="col-lg-9">
							<textarea  class="form-control" name="brief">{$member_info['brief']}</textarea>
						</div>
					</div>
					<div class="form-group">
						<label class="col-lg-2 control-label" for="disabledInput">联系人</label>
						<div class="col-lg-6">
							<input class="form-control" name="contacts" value="{$member_info['contacts']}" datatype="*" nullmsg="联系人不能为空" type="text">
						</div>
					</div>
					<div class="form-group city_select_plug">
						<label class="col-lg-2 control-label" for="optionsCheckbox2">地区</label>
						<div class="col-lg-3">
							<select class="form-control" datatype="*" nullmsg="请选择省" name="province_id" id="province_select" data-value="{$member_info['province_id']}">
								<option value="">省</option>
							</select>
						</div>
						<div class="col-lg-3">
							<select class="form-control" datatype="*" nullmsg="请选择市" name="city_id" id="city_select" data-value="{$member_info['city_id']}">
								<option value="">市</option>
							</select>
						</div>
						<div class="col-lg-3">
							<select class="form-control" datatype="*" nullmsg="请选择区" name="area_id" id="area_select" data-value="{$member_info['area_id']}">
								<option value="">区</option>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-lg-2 control-label">详细地址</label>
						<div class="col-lg-9">
							<input class="form-control" datatype="*" value="{$member_info['address']}" nullmsg="详细地址不能为空" name="address" type="text">
						</div>
					</div>
					<div class="form-group">
						<label class="col-lg-2 control-label">&nbsp;</label>
						<div class="col-lg-9">
							<div style="width:100%; height:300px; border:1px solid #ccc;" id="allmap"></div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-lg-2 control-label">定位坐标</label>
						<div class="col-lg-3">
							<input class="form-control" readonly name="lng" datatype="*" nullmsg="请选择经纬度" style="background:#efefef" value="{$member_info['lng']}" id="lng" placeholder="经度" type="text">
						</div>
						<div class="col-lg-3">
							<input class="form-control" readonly name="lat" datatype="*" nullmsg="请选择经纬度" style="background:#efefef" value="{$member_info['lat']}" id="lat" placeholder="纬度" type="text">
						</div>
					</div>
					<div class="form-group">
						<label class="col-lg-2 control-label">企业性质</label>
						<div class="col-lg-6">
							<select class="form-control" name="nature">
								<foreach name="conf.NATURE" key="k" item="vo">
								<option value="{$k}" <eq name="k" value="$member_info['nature']">selected</eq>>{$vo}</option>
								</foreach>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-lg-2 control-label">企业规模</label>
						<div class="col-lg-6">
							<select class="form-control" name="scale">
								<foreach name="conf.SCALE" key="k" item="vo">
								<option value="{$k}" <eq name="k" value="$member_info['scale']">selected</eq>>{$vo}</option>
								</foreach>
							</select>
						</div>
					</div>
					<button type="submit" style=" margin-left:162px;" class="btn btn-primary">确认修改</button>
				</form>
			</div>
		</div>
	</div>
</div>
</block>
<block name="script">
	<script type="text/javascript">
		var map = new BMap.Map("allmap");
		$(function(){
			var lng = $("#lng").val();
			var lat = $("#lat").val();
			var point = new BMap.Point(lng,lat);
			map.centerAndZoom(point,11);
			bImg(lng,lat);
		});
		setTimeout(function(){
			map.setZoom(14);   
		}, 2000);  //2秒后放大到14级

		map.enableScrollWheelZoom(true); 
		map.addEventListener("click", showInfo);
		function showInfo(e){
			$("#lng").val(e.point.lng);
			$("#lat").val(e.point.lat);
			bImg(e.point.lng,e.point.lat)
		}
		function bImg(lng,lat){
			var point = new BMap.Point(lng,lat);
			map.clearOverlays();
			var marker = new BMap.Marker(point); 
			map.addOverlay(marker);  
			marker.setAnimation(BMAP_ANIMATION_BOUNCE);
		}
		$(".city_select_plug select").change(function(){
			var city_data = '';
			var index_num = $(this).parent().index();
			$(".city_select_plug select").each(function(k){
				var selct_txt = $(this).find('option:selected').text();
				if( selct_txt != '省' && selct_txt != '市' && selct_txt != '区' && k < index_num) {
					city_data += selct_txt;
				}
			});
			map.centerAndZoom(city_data,(index_num == 1 ? 11 : ( index_num == 2 ? 12 : 15)));
		});
	</script>
</block>